-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_ordered_columns and datetime_generator implementation + tests #313
get_ordered_columns and datetime_generator implementation + tests #313
Conversation
tests/test_dataset_generator.py
Outdated
|
||
|
||
class TestDatasetGenerator(unittest.TestCase): | ||
def test_get_ordered_column_datetime(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests that get_ordered_column returns datetime numpy array in ascending order while still maintaining the original datetime format inserted into it
for i in range(len(output_data)): | ||
self.assertTrue(np.array_equal(output_data[i], ordered_data[i])) | ||
|
||
def test_get_ordered_column_datetime_descending(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests that get_ordered_column returns datetime numpy array in descending order while still maintaining the original datetime format inserted into it.
print(output_data[i], "GG", ordered_data[i]) | ||
self.assertTrue(np.array_equal(output_data[i], ordered_data[i])) | ||
|
||
def test_get_ordered_column(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These last two tests test that get_ordered_column returns numpy array in ascending/descending order
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
sorted_data = np.array(sorted(data, key=lambda x: x[1])) | ||
sorted_data = sorted_data[:, 0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be sorting by the object or string, @taylorfturner thoughts here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't sorting by string cause it to sort alphabetically instead of by date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix one test to clarify what we should see in the output for datetime.
|
||
def test_get_ordered_column(self): | ||
|
||
data = OrderedDict( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should have datetime be in here too so we can see the exact output.
tests/test_dataset_generator.py
Outdated
output_data.append(dg.get_ordered_column(data[data_type], data_type)) | ||
output_data = np.asarray(output_data) | ||
|
||
self.assertTrue(np.array_equal(output_data, ordered_data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of this and in the other tests, we can do np.testing.assert_array_equal
I believe.
replaced by PR #323 |
Added order_generator to dataset_generator